<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:body>
	<ui:composition>
		<ui:insert name="mainMenu">
			<h:form id="formMenuHeader">
				<div id="divMenu">
					<p:growl id="messages" />
					<p:menubar>
						<p:menuitem value="Home Page"
							oncomplete="handleHomeRequest(xhr, status, args)"
							icon="ui-icon-home" />

						<p:menuitem value="Mail Box"
							oncomplete="handleMailRequest(xhr, status, args)"
							icon="ui-icon-mail-open" />

						<p:submenu label="Actions" icon="ui-icon-gear">
							<p:menuitem value="Profil Actions"
								rendered="#{userLoginBean.user.roles.profil_actions}"
								oncomplete="handleProfilActionsRequest(xhr, status, args)"
								icon="ui-icon-refresh" />
							<p:submenu label="User Actions"
								rendered="#{userLoginBean.user.roles.user_actions}"
								icon="ui-icon-refresh">
								<p:menuitem value="All Users"
									rendered="#{userLoginBean.user.roles.all_user}"
									oncomplete="handleUserRequest(xhr, status, args)"
									icon="ui-icon-disk" />
								<p:menuitem value="All Teachers"
									rendered="#{userLoginBean.user.roles.all_teacher}"
									oncomplete="handleTeacherRequest(xhr, status, args)"
									icon="ui-icon-person" />
								<p:menuitem value="All Student"
									rendered="#{userLoginBean.user.roles.all_student}"
									oncomplete="handleStudentRequest(xhr, status, args)"
									icon="ui-icon-person" />
								<p:menuitem value="All Lessons"
									rendered="#{userLoginBean.user.roles.all_lesson}"
									oncomplete="handleLessonRequest(xhr, status, args)"
									icon="ui-icon-disk" />
								<p:menuitem value="Semester For Lesson"
									rendered="#{userLoginBean.user.roles.semester_lessons}"
									oncomplete="handleSemesterRequest(xhr, status, args)"
									icon="ui-icon-note" />
								<p:menuitem value="Semester For Notes"
									rendered="#{userLoginBean.user.roles.semester_notes}"
									oncomplete="handleSemesterRequest(xhr, status, args)"
									icon="ui-icon-note" />
								<p:menuitem value="Teacher and Lesson"
									rendered="#{userLoginBean.user.roles.adding_lesson_teacher}"
									oncomplete="handleTeacherLessonRequest(xhr, status, args)"
									icon="ui-icon-disk" />
							</p:submenu>

							<p:submenu label="Teacher Affairs"
								rendered="#{userLoginBean.user.roles.teacher_affairs}"
								icon="ui-icon-newwin">
								<p:menuitem value="All Project"
									rendered="#{userLoginBean.user.roles.all_project}"
									oncomplete="handleProjectRequest(xhr, status, args)"
									icon="ui-icon-disk" />
								<p:menuitem value="Lesson Notes"
									rendered="#{userLoginBean.user.roles.notes_lesson}"
									icon="ui-icon-note" ajax="true" />
								<p:menuitem value="Project Notes"
									rendered="#{userLoginBean.user.roles.notes_project}"
									icon="ui-icon-close" ajax="true" />
							</p:submenu>

							<p:submenu label="Student Affairs"
								rendered="#{userLoginBean.user.roles.student_affairs}"
								icon="ui-icon-newwin">
								<p:menuitem value="Choose Lesson"
									rendered="#{userLoginBean.user.roles.choose_lesson}"
									oncomplete="handleChooseLessonRequest(xhr, status, args)"
									icon="ui-icon-note" update="messages" ajax="true" />
								<p:menuitem value="Choose Project"
									rendered="#{userLoginBean.user.roles.choose_project}"
									icon="ui-icon-close" update="messages" ajax="true" />
							</p:submenu>

							<p:submenu label="Account Settings"
								rendered="#{userLoginBean.user.roles.account_settings}"
								icon="ui-icon-newwin">
								<p:menuitem value="Edit Profil"
									rendered="#{userLoginBean.user.roles.edit_profil}"
									url="home.jsf" icon="ui-icon-pencil" />
								<p:menuitem value="Change Password"
									rendered="#{userLoginBean.user.roles.change_password}"
									url="home.jsf" icon="ui-icon-pencil" />
								<p:menuitem value="Delete Account"
									rendered="#{userLoginBean.user.roles.delete_account}"
									url="home.jsf" icon="ui-icon-close" />
							</p:submenu>

						</p:submenu>



						<f:facet name="options">
							<p:inputText style="margin-right:10px" />
							<p:commandButton id="logOut" value="Logout"
								oncomplete="handleLogoutRequest(xhr, status, args)" />
						</f:facet>
					</p:menubar>
				</div>
			</h:form>

			<script type="text/javascript">

			 	function handleLogoutRequest(xhr, status, args) {
			 		jQuery('#logOut').fadeOut();
		        	window.location = "${request.contextPath}/flows/login/login.jsf?execution=e90989s0";
			 	}

			 	function handleProfilActionsRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/profilactions.jsf?execution=e9p9s0";
			 	}
			 	
			 	function handleUserRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/alluser.jsf?execution=a4u9";
			 	}

			 	function handleTeacherRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/allteacher.jsf?execution=a4s4";
			 	}

			 	function handleMailRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/mail/mailbox.jsf?execution=m4x8";
			 	}
			 	
			 	function handleHomeRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/home/home.jsf?execution=e9s3";
			 	}
			 	
			 	function handleStudentRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/allstudent.jsf?execution=s9t5";
			 	}
			 	
			 	function handleSemesterRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/semester.jsf?execution=x9s5";
			 	}
			 	
			 	function handleTeacherLessonRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/allteacherlessons.jsf?execution=t20l";
			 	}
			 	
			 	function handleLessonRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/alllesson.jsf?execution=g4a5";
			 	}
			 	
			 	function handleProjectRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/actions/allproject.jsf?execution=p2s3";
			 	}
			 	
			 	function handleChooseLessonRequest(xhr, status, args) {
		        	window.location = "${request.contextPath}/flows/choose/chooselesson.jsf?execution=c4l9";
			 	}
			 	
  		  </script>

		</ui:insert>
	</ui:composition>
</h:body>
</html>
